package net.suncaper.demo.service;

import net.suncaper.demo.domain.Information;
import net.suncaper.demo.domain.InformationExample;
import net.suncaper.demo.mapper.InformationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.List;
@Service
public class InformationServiceImpl implements InformationService{
    @Autowired
    private InformationMapper informationMapper;

    @Override
    public void saveInformation(Information information) {
       informationMapper.insert(information);
    }


    @Override
    public void updateInformation(Information information) {
    informationMapper.updateByPrimaryKeyWithBLOBs(information);
    }

    @Override
    public void deleteInformationById(BigDecimal id) {
       informationMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Information findInformationById(BigDecimal informationId) {
        return informationMapper.selectByPrimaryKey(informationId);
    }

    @Override
    public List<Information> findInformation() {

        return informationMapper.selectByExample(new InformationExample());
    }
//    @Override
//    public List<Information> findInformationBytitle(String title) {
//        InformationExample information=new InformationExample();
//        information.setOrderByClause(title);
//        return informationMapper.selectByExample(information);
//    }
}
